/**
 * 创建人:  @author huangpeng
 * 创建时间:  2024年10月13日 21:20
 * 项目名称:  lemon-blog-cloud
 * 文件名称:  ElasticsearchFeignController
 * 文件描述:  @Description: Elasticsearch远程调用feign接口
 * 公司名称:  xxxxxx
 * <p>
 * All rights Reserved, Designed By xxxxxx
 *
 * @Copyright: 2021-2024
 */
package com.lemon.search.controller.feign;

import com.lemon.common.core.web.domain.AjaxResult;
import com.lemon.search.service.ElasticSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 包名称：com.lemon.search.controller.feign
 * 类名称：ElasticsearchFeignController
 * 类描述：Elasticsearch远程调用feign接口
 * 创建人：@author huangpeng
 * 创建时间：2024年10月13日 21:20
 */
@Api(value = "Elasticsearch远程调用feign接口", tags = {"Elasticsearch远程调用feign接口"})
@RestController
@RequestMapping("/api/search/search")
public class ElasticsearchFeignController {

    @Autowired
    private ElasticSearchService searchService;

    /**
     * 初始化Elasticsearch索引
     * @Title: initElasticSearchIndex
     * @Description: 初始化Elasticsearch索引
     * @return: AjaxResult
     * @param request 请求头
     * @throws:
     * @author: huangpeng
     * @Date: 2024/10/2 01:01
     */
    @ApiOperation(value = "ElasticSearch初始化索引", notes = "ElasticSearch初始化索引", response = String.class)
    @PostMapping("/initElasticSearchIndex")
    public AjaxResult initElasticSearchIndex(HttpServletRequest request) {
        searchService.initElasticSearchIndex(request);
        return AjaxResult.success("ElasticSearch初始化索引成功");
    }

}
